/*
 * @Author: Wangtao
 * @Date: 2022-08-29 17:27:21
 * @LastEditors: Wangtao
 * @LastEditTime: 2022-09-12 14:45:30
 */
import fetch from '@/common/utils/http'


/* 获取高级检索 */
export const getQuickQuery = (data: any) =>
  fetch({
    url: '/call/web/cdr/quickQuery/list',
    method: 'POST',
    data
  })

/* 更新或插入高级检索 */
export const saveOrUpdateQuickQuery = (data: any) =>
  fetch({
    url: '/call/web/cdr/quickQuery/saveOrUpdate',
    method: 'POST',
    data
  })

/* 删除高级检索 */
export const deleteQuickQuery = (data: any) =>
  fetch({
    url: '/call/web/cdr/quickQuery/delete',
    method: 'POST',
    data
  })

/* 获取最近通话记录 */
export const getCdrLatest = (data: any) =>
  fetch({
    url: '/call/web/cdr/latest',
    method: 'POST',
    data
  })

/* 获取通话记录 */
export const getCdrList = (data: any) =>
  fetch({
    url: '/call/web/cdr/list',
    method: 'POST',
    data
  })
/* 获取通话记录的表头 */
export const getCdrHeader = (data: any) =>
  fetch({
    url: '/call/web/cdr/query/header',
    method: 'POST',
    data
  })
/* 设置通话记录的表头 */
export const setCdrHeader = (data: any) =>
  fetch({
    url: '/call/web/cdr/saveOrUpdate/header',
    method: 'POST',
    data
  })

// 获取ivr轨迹
export const getIvrList = (data: any) =>
  fetch({
    url: '/call/web/ivrFlow/list',
    method: 'POST',
    data
  })

export const getCdrDetail = (data: any) =>
  fetch({
    url: '/call/web/cdr/detail',
    method: 'POST',
    data
  })

// 通过号码定位客户
export const getCustomerByMobile = (data: any) =>
  fetch({
    url: '/crm/action/customer/listByMobile',
    method: 'POST',
    data
  })

// 更新客户与通话关联关系
export const cdrCustomerRelation = (data: any) =>
  fetch({
    url: '/crm/action/cdrCustomerRelation/saveOrUpdate',
    method: 'POST',
    data
  })
// 通话卡片保存新客户
export const saveCustomer = (data: any) =>
  fetch({
    url: '/crm/action/customer/add',
    method: 'POST',
    data
  })

// 通话卡片保存新客户
export const updateCustomer = (data: any) =>
  fetch({
    url: '/crm/action/customer/update',
    method: 'POST',
    data
  })

// 保存服务小计
export const saveServerNode = (data: any) =>
  fetch({
    url: '/crm/action/server-note/insert',
    method: 'POST',
    data
  })

// 服务小计日志
export const serverNodeLog = (data: any) =>
  fetch({
    url: '/crm/action/server-note/query',
    method: 'POST',
    data
  })

// 软电话相关接口

// 获取webrct注册地址

export const webRtcRegisterInfo = (params: any) =>
  fetch({
    url: '/call/api/sip/webRtcRegisterInfo',
    method: 'GET',
    params
  })

// 外呼
export const dialOut = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/dialOut',
    method: 'POST',
    data
  })
// 挂机
export const hangup = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/hangup',
    method: 'POST',
    data
  })
// 静音/取消静音
export const muteOrUnMute = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/muteOrUnMute',
    method: 'POST',
    data
  })
// 保持/取消保持
export const holdOrUnHold = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/holdOrUnHold',
    method: 'POST',
    data
  })
// 转接
export const transfer = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/transfer',
    method: 'POST',
    data
  })
// 转满意度
export const satisfaction = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/transfer/satisfaction',
    method: 'POST',
    data
  })
// 咨询
export const consult = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/consult',
    method: 'POST',
    data
  })
// 取消咨询
export const cancelConsult = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/cancelconsult',
    method: 'POST',
    data
  })
// 结束咨询
export const stopConsult = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/stopConsult',
    method: 'POST',
    data
  })
// 咨询接回
export const resumeConsult = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/resumeConsult',
    method: 'POST',
    data
  })
// 咨询转接
export const consultTransfer = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/consultTransfer',
    method: 'POST',
    data
  })
// 三方
export const threeWayCall = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/call/threeWayCall',
    method: 'POST',
    data
  })

// 座席api
export const getAgentPhoneBarList = (data: any) =>
  fetch({
    url: '/call/api/phone/bar/all',
    method: 'GET',
    data
  })
// 座席api
export const setAgentStatus = (data: any) =>
  fetch({
    url: '/call/api/agent/v1/agent-status/change',
    method: 'POST',
    data
  })
// 切换接听方式
export const changeLoginType = (data: any) =>
  fetch({
    url: '/call/api/agent/v1/login-type/change',
    method: 'POST',
    data
  })
// 更新个人通话配置
export const updateCallConfig = (data: any) =>
  fetch({
    url: '/platform/action/updateCallConfig',
    method: 'POST',
    data
  })
// 获取sip号
export const getSipNum = (data: any) =>
  fetch({
    url: '/call/api/sip/agent-can-use',
    method: 'POST',
    data
  })
// 获取ivr列表
export const geSdkIvrList = (data: any) =>
  fetch({
    url: '/call/api/call/sdk/v1/ivr/find',
    method: 'POST',
    data
  })
// 获取该账户下空闲的座席
export const geIdelAgent = (data: any) =>
  fetch({
    url: '/call/api/queue/acountFreeAgent/find',
    method: 'POST',
    data
  })
